package org.hackystat.devcathlon.ui.page.commons.panels;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;

/**
 * Information Box Panel. 
 * This is the common panel used across many sections of Devcathlon. 
 *  
 * @author Anthony Du
 * 
 */
public abstract class InfoBoxPanel extends Panel {
  /** Support serialization. */
  private static final long serialVersionUID = 1L;
  /** Info Box header title. */
  private String title = "[title]";
  /** Default box content id. */
  public static final String contentID = "boxContent";
  
  /**
   * Info Box Panel constructor given only the ID.
   * @param id unique DOM id
   */
  public InfoBoxPanel(String id) {
    super(id);
    add(new Label("infoHeader", title));
  }
  
  /**
   * Info Box Panel constructor given the title.
   * @param id panel id
   * @param title panel title
   */
  public InfoBoxPanel(String id, String title) {
    super(id);
    this.title = title;
    add(new Label("infoHeader", this.title));
    // invoking this is bad but...works since no other class will have to extend from this one!
    createContent(); 
  }
  
  /**
   * Create content component. This method is meant to be overridden
   */
  protected abstract void createContent();
}
